package com.suyx.job.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.suyx.job.entity.GoodsInfo;
import com.suyx.job.entity.TaskInfo;


/**
 * @Auther: lanyanhua
 * @Date: 2018/10/18 0018 11:34
 * @Description:
*/
@Repository
public interface TaskInfoRepository extends JpaRepository<TaskInfo,Integer> ,JpaSpecificationExecutor<TaskInfo> {

	@Query(value = "select * from task_info where task_info.status = '0' and task_info.wp_Type = :wpType and task_info.jq_no = :jqNo  order by create_time desc limit 1",nativeQuery = true)
	TaskInfo findByWpTypeAndJqNo(@Param("wpType") Integer wpType,@Param("jqNo") Integer jqNo);
	
	@Query(value = "select * from task_info where task_info.status = '0' and task_info.role_id = :roleId and task_info.task_text = :taskText  ",nativeQuery = true)
	TaskInfo findByRoleIdAndTaskText(@Param("roleId") String roleId,@Param("taskText") String taskText);
	
	List<TaskInfo> findByJqNoAndStatus(Integer jqNo,String status);
}
	